/*
 * ConsultaProducao.java
 *
 * 
 */
package br.faimg.pomar.visual;

import br.faimg.pomar.controle.componentevisual.TableConsultaProducao;
import javax.swing.JTable;

/**
 *
 * @author  Juliana
 */
public class ConsultaProducao extends javax.swing.JInternalFrame {
      
     public ConsultaProducao() {
        initComponents();
        updateTable();

    }

    private void updateTable() {
        //Lista os itens cadastrados no banco na tablela
         tabelaConsultaProdJTable.setModel(new JTable(
         new TableConsultaProducao().getTableModel()
         ).getModel());
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        cancelarButton = new javax.swing.JButton();
        AtualizarButton = new javax.swing.JButton();
        tabelaScrollPane = new javax.swing.JScrollPane();
        tabelaConsultaProdJTable = new javax.swing.JTable();
        jSeparator1 = new javax.swing.JSeparator();

        setTitle("Consulta Status Produção");
        setVerifyInputWhenFocusTarget(false);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        cancelarButton.setText("Cancelar");
        cancelarButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelarButtonActionPerformed(evt);
            }
        });
        jPanel1.add(cancelarButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(540, 330, 90, -1));

        AtualizarButton.setText("Atualizar");
        AtualizarButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AtualizarButtonActionPerformed(evt);
            }
        });
        jPanel1.add(AtualizarButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(440, 330, 90, -1));

        tabelaScrollPane.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tabelaScrollPaneMouseClicked(evt);
            }
        });

        tabelaConsultaProdJTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tabelaConsultaProdJTable.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tabelaConsultaProdJTableMouseClicked(evt);
            }
        });
        tabelaScrollPane.setViewportView(tabelaConsultaProdJTable);

        jPanel1.add(tabelaScrollPane, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 50, 610, 240));
        jPanel1.add(jSeparator1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 30, 610, 30));

        getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 10, 660, 380));

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void AtualizarButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AtualizarButtonActionPerformed
    updateTable();
}//GEN-LAST:event_AtualizarButtonActionPerformed

private void cancelarButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelarButtonActionPerformed
    this.setVisible(isIcon);
}//GEN-LAST:event_cancelarButtonActionPerformed

private void tabelaScrollPaneMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabelaScrollPaneMouseClicked
    
}//GEN-LAST:event_tabelaScrollPaneMouseClicked

private void tabelaConsultaProdJTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabelaConsultaProdJTableMouseClicked
   
}//GEN-LAST:event_tabelaConsultaProdJTableMouseClicked

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton AtualizarButton;
    private javax.swing.JButton cancelarButton;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JTable tabelaConsultaProdJTable;
    private javax.swing.JScrollPane tabelaScrollPane;
    // End of variables declaration//GEN-END:variables
}
